<!DOCTYPE html>
<html>
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <title>$.String.unescapeHTML</title>
        <script>
            window.$$path = location.protocol + "//" + location.host;
            document.write('<script src="' + $$path + '/mass_merge.js"><\/script>')
            document.write('<script src="' + $$path + '/doc/scripts/common.js"><\/script>')
        </script>
    </head>
    
    <body>
        <article>
            <h3>$.String.unescapeHTML( str )</h3>
            <p>
                <span class="stress">描述：</span>
            </p>
            <p>将用escapeHTML方法处理过的字符串，还原为可以document解析为HTML标签的字符串。</p>
            <pre class="brush:javascript;gutter:false;toolbar:false">
unescapeHTML: function(target) {
    return target.replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, "&");
    //处理转义的中文和实体字符
    return target.replace(/&#([\d]+);/g, function(_0, _1) {
        return String.fromCharCode(parseInt(_1, 10));
    });
},
</pre>
            <fieldset>
                <legend>例子</legend>
                <pre class="brush:javascript;gutter:false;toolbar:false">
$.require("lang", function($$) {
    var str = "&lt;h1>&gt;Pride &amp; Prejudice&lt;/h1>&gt;";
    $.log($.String.unescapeHTML(str), true);
     str = "x &gt; 10";
     $.log($.String.unescapeHTML(str), true);
});
</pre>
                <button class="doc_btn" type="button">点我，执行代码</button>
            </fieldset>
        </article>
    </body>

</html>